package service

import (
	"hcy-go/global/structs/lms"
	"hcy-go/global/structs/table"
	"hcy-go/modules/lms/repository"
)

type CoursewareSer struct {
}

func (s CoursewareSer) Create(in lms.AddCourseware) (err error) {
	m := table.Courseware{
		CoursewareId:       0,
		CoursewareCode:     in.Code,
		Kind:               in.Kind,
		FilePath:           "",
		FileSize:           0,
		MD5:                "",
		With:               "",
		Height:             "",
		Page:               0,
		ExtensionName:      "",
		Label:              "",
		CoursewareFolderId: 0,
		AllowDownload:      false,
		AutoCreateInfo:     table.AutoCreateInfo{},
	}
	err = repository.CoursewareDb{}.Save(&m)
	return err
}
